//_ _ _ _ (_|_) __ _
//| | | | | | || | |/ _` |
//| |_| | |_| || | | (_| |
//\__, |\__,_|/ |_|\__,_|
//|___/ |__/
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=5e5+10;
const int mod=1e9+7;
int f[710][710];
// int dp[N][N],f[N][N];
int a[N],b[N];
int c[60][60][60][60];
void yujia(){
int op,x,y;
cin >> op >> x >> y;
if(op==1)
{
for(int i=1;i<=707;i++)f[i][x%i]+=y;
a[x]+=y;
}
else{
if(x<=707)
cout << f[x][y] << '\n';
else{
int sum=0;
for(int i=y;i<=500000;i+=x){
sum+=a[i];
}
cout << sum << '\n';
}
}
}
signed main(){
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int molinyuni=1;
cin >> molinyuni;
while(molinyuni--){
yujia();
}
return 0;
}
515A - Drazil and Date | 1084B - Kvass and the Fair Nut |
1101A - Minimum Integer | 985D - Sand Fortress |
1279A - New Year Garland | 1279B - Verse For Santa |
202A - LLPS | 978A - Remove Duplicates |
1304A - Two Rabbits | 225A - Dice Tower |
1660D - Maximum Product Strikes Back | 1513A - Array and Peaks |
1251B - Binary Palindromes | 768B - Code For 1 |
363B - Fence | 991B - Getting an A |
246A - Buggy Sorting | 884A - Book Reading |
1180A - Alex and a Rhombus | 445A - DZY Loves Chessboard |
1372A - Omkar and Completion | 159D - Palindrome pairs |
981B - Businessmen Problems | 1668A - Direction Change |
1667B - Optimal Partition | 1668B - Social Distance |
88B - Keyboard | 580B - Kefa and Company |
960A - Check the string | 1220A - Cards |